#ifndef __FILETRANSFER_H
#define __FILETRANSFER_H

#include  "cfg_main.h"

#define UPDATA_PROG_START_ADDR  (1024 * 4)

extern INT8U gFileTransFlag[128];


__packed typedef struct
{
    INT8U id;
    INT8U attr;
    INT8U cmd;
    INT16U numOfSection;
    INT32U offset;
    INT16U size;
    INT8U data[1];
}FileTransferDataType;

__packed typedef struct
{
    INT8U dlstatus;
    INT32U dlsize;

    INT8U id;
    INT8U attr;
    INT8U cmd;
    INT16U numOfSection;
    INT32U offset;
    INT16U sectionsize;

    INT32U dlnextbyte;
    INT8U chkbyte;
}DLFwUpdateType;

void FilsTransInit(void);
void FileTransfer(GdSuperFrameType *pLCSuperFrame);
void FileTransInfoInit(void);
void FileTransUpdateInfo(void);
void ArgGetTmDownloadFileInfo(DLFwUpdateType *buff);
void ArgGetBakTmDownloadFileInfo(DLFwUpdateType *buff);
INT8U FileTransWriteFlash(INT8U *buff, INT16U size, INT32U addr);
BOOL FileTransCRCCheck(INT32U totalSize, INT16U chkCrc, INT16U blockSize);


#endif

